package com.portme.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.portme.shared.ClientCustomTab;
import com.portme.shared.ClientPost;
import com.portme.shared.LoginInfo;
import com.portme.shared.UserProfile;

public class PortmeServiceClient {
	
	private static PortmeServiceClient theInstance = new PortmeServiceClient();
	
	/**
	 * Create a remote service proxy to talk to the server-side Greeting service.
	 */
	private final GreetingServiceAsync greetingService = GWT
			.create(GreetingService.class);
	
	public static PortmeServiceClient getInstance() {
		return theInstance;
	}
	
	private PortmeServiceClient() {}
	
	public void getLoginUrl(AsyncCallback<LoginInfo> callback) {
		greetingService.getLoginUrl(callback);
	}
	
	public void createTab(String tabTitle, AsyncCallback<ClientCustomTab> callback) {
		greetingService.createTab(tabTitle, callback);
	}
	
	public void getUserPortfolio(String user, AsyncCallback<UserProfile> callback) {
		greetingService.getUserPortfolio(user, callback);
	}
	
	public void createPost(Long tabId, String title, String text, AsyncCallback<ClientPost> callback) {
		greetingService.createPost(tabId, title, text, callback);
	}
	
	public void editPost(Long tabId, String title, String text, AsyncCallback<ClientPost> callback) {
		greetingService.editPost(tabId, title, text, callback);
	}
	
	public void setTheme(String themeName, AsyncCallback<String> callback)
	{
		greetingService.setTheme(themeName, callback);
	}
	
	public void deletePost(Long postId, AsyncCallback<Boolean> callback) {
		greetingService.deletePost(postId, callback);
	}
}
